//
//  ViewController.m
//  UILabel
//
//  Created by liuchengming on 16/7/27.
//  Copyright © 2016年 liuchengming. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end



@implementation ViewController

- (void)CraeateUI  //添加uilabel控件函数
{
    UILabel * label = [UILabel new];
    
    //label 的内容
    label.text = @"hello world! my name is zhangsan. my age is 25!";
    
    //文字的颜色
    label.textColor = [UIColor redColor];
    
    //label.tintColor = [UIColor blueColor];
    
    //UILabel的位置
    label.frame = CGRectMake(100, 100, 160, 100);
    
    label.backgroundColor =[UIColor clearColor];
    //clearColor 是指透明颜色
    
    //背景颜色
    self.view.backgroundColor = [UIColor cyanColor];
    
    //label的高级属性
    //设置字体大小
    label.font =[UIFont systemFontOfSize:18];
    
    //label 的阴影
    label.shadowColor = [UIColor grayColor];
    //label 阴影的偏移量
    label.shadowOffset = CGSizeMake(3, -5);
    
    //居中对齐
    label.textAlignment = NSTextAlignmentCenter;
    
    //如果文字超过显示  使用 0 则是自动调整行数
    label.numberOfLines = 0;
    
    
    // 添加到视图
    [self.view addSubview:label];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    [self CraeateUI];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
